

package io.lkt.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;
import io.lkt.modules.sys.dao.BUserInviteIncomeInfoDao;
import io.lkt.modules.sys.entity.BUserInviteIncomeInfoEntity;
import io.lkt.modules.sys.service.BUserInviteIncomeInfoService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class BUserInviteIncomeInfoServiceImpl extends ServiceImpl<BUserInviteIncomeInfoDao, BUserInviteIncomeInfoEntity> implements BUserInviteIncomeInfoService {
    @Autowired
    private BUserInviteIncomeInfoDao bUserInviteIncomeInfoDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String)params.get("key");

        IPage<BUserInviteIncomeInfoEntity> page = this.page(
            new Query<BUserInviteIncomeInfoEntity>().getPage(params),
            new QueryWrapper<BUserInviteIncomeInfoEntity>().like(StringUtils.isNotBlank(key),"username", key)
        );

        return new PageUtils(page);
    }

    @Override
    public List<BUserInviteIncomeInfoEntity> getInfoByUserId(Map<String, Object> params) {
        return bUserInviteIncomeInfoDao.getInfoByUserId(params);
    }

    @Override
    public Integer getInfoByUserIdTotal(Map<String, Object> params) {
        return bUserInviteIncomeInfoDao.getInfoByUserIdTotal(params);
    }
}
